 /**
权限控制
 */
import cache from '@/plugins/cache'
import {permissionsKey,userinfo} from "@/constants/userConstant";
export default {
  inserted(el, binding, vnode) {
    const { value } = binding
    const all_permission = "*:*:*";
    const permissions = cache.local.getUserPermis()
    if (value && value instanceof Array && value.length > 0) {
      // 判断后台的用户权限是否符合设置的权限
      var c = value.filter(function(v){ return permissions.indexOf(v) > -1 })
      if (c.length == 0){
        el.parentNode && el.parentNode.removeChild(el)
      }


    } else {
      throw new Error(`请设置操作权限标签值`)
    }
  }
}
